package me.numark;

import android.content.ContentValues;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.TextView;

import butterknife.ButterKnife;
import butterknife.InjectView;
import me.numark.fragments.CommentsFragment;
import me.numark.fragments.ProfileFragment;
import me.numark.providers.Numa;


public class MyCommentsActivity extends FragmentActivity {

    @InjectView(R.id.back)
    View back;

    @InjectView(R.id.title)
    TextView title;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_comments);
        ButterKnife.inject(this);
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        title.setText(R.string.all_comments);
        Fragment fragment = ProfileFragment.instantiate(this,
                CommentsFragment.class.getName(), null);
        getSupportFragmentManager().beginTransaction().add(R.id.fragment, fragment).commit();
        clearBadge();
    }

    protected void clearBadge() {
        ContentValues values = new ContentValues();
        values.put("badge", 0);
        getContentResolver().update(Numa.DialogColumns.CONTENT_URI, values, "_id=0", null);
    }
}
